package shop;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ListProductsScreen implements Screen{
	private Console console;
	private ListProducts LP;

	@Autowired
	public ListProductsScreen(ListProducts lP, Console c) {
		super();
		LP = lP;
		console = c;
	}
	
	public void show() {
		console.println("---------List Product Screen---------");
		List<Product> listProduct = LP.listAllProduct();
		for (Product p : listProduct) {
			console.printf("ID : %s  ", p.getId());
			console.printf("Name : %s  ", p.getName());
			console.printf("Price : %s  \n", p.getPrice());
		}
	}

}
